package com.spa.infrastructure.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.command.admin.ShopUserAddCommand;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.ShopUserDTO;
import com.spa.application.dto.admin.ShopUserExportDTO;
import com.spa.application.query.admin.ShopUserQuery;
import com.spa.domain.entity.ShopUser;
import com.spa.infrastructure.repository.condition.ShopUserCondition;
import com.spa.infrastructure.repository.po.ShopUserPO;
import org.mapstruct.Mapper;
import org.mapstruct.MapperConfig;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
@MapperConfig(unmappedTargetPolicy = ReportingPolicy.WARN)
public interface ShopUserMapperStruct {

    ShopUserMapperStruct INSTANCE = Mappers.getMapper(ShopUserMapperStruct.class);

    ShopUserPO command2Po(ShopUserAddCommand command);

    ShopUserCondition query2Condition(ShopUserQuery query);

    Page<ShopUser> po2Entity(Page<ShopUserPO> po);
    ShopUser po2Entity(ShopUserPO po);

    PageResult<ShopUserDTO> entity2Dto4Page(Page<ShopUser> entity);

    @Mapping(source = "shop.name", target = "shopName")
    ShopUserDTO entity2Dto(ShopUser entity);


    List<ShopUser> po2Entity(List<ShopUserPO> po);

    List<ShopUserExportDTO> entity2ShopExportDto(List<ShopUser> shopUsers);
}
